package com.igeek.test;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.junit.Test;

import com.igeek.common.utils.CommUtils;
import com.igeek.common.utils.DataSourceUtils;
import com.igeek.shop.entity.User;

public class Demo {
	
	@Test
	public void demo1() {
		User user = new User();
		QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource());
		String sql = "insert into user values(?,?,?,?,?,?,?,?,?,?)";
		 try {
			 user.setUid(CommUtils.getUUID());
			 user.setUsername("jack");
			 user.setPassword("123");
			 user.setName("tom");
			 user.setEmail("123@163.com");
			 user.setTelephone("123456");
			 
			 
			runner.update(sql, user.getUid(), user.getUsername(), user.getPassword(), user.getName(),
					user.getEmail(), user.getTelephone(), user.getBirthday(), user.getSex(), user.getState(),
					user.getCode());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
